# Maintainer: Konstantin Gizdov <arch at kge dot pw>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Baptiste Jonglez <baptiste--aur at jonglez dot org>
# Contributor: Yann Lopez <arch at lonewulf dot net>

pkgname=babeld
pkgver=1.12.2
pkgrel=1
pkgdesc="A loop-avoiding distance-vector routing protocol"
arch=('loong64' 'x86_64')
url="https://www.irif.fr/~jch/software/babel/"
license=('MIT')
depends=('glibc')
backup=('etc/babeld.conf')
source=("https://www.irif.fr/~jch/software/files/$pkgname-$pkgver.tar.gz"{,.asc}
        'babeld.conf' 'babeld.service')
validpgpkeys=('F8E70AAD74D32CAC27B9AFD62652C881EADB5526')
sha512sums=('fb0598beacc8df184e947d919b6f0805383eea991d1fbbe60ad05fda13c99c65f89c0ebd950a8a463e3dc6eae539ea177a41098775b65f29b381fb5df136cad1'
            'SKIP'
            '1232684447b4409d6e3813041f4ab1158faa844b5ac65441b5f299f1e353f48679aacbce9cc79e6714e9a3e1b17d2cfa4963c1388dba225ee342ea3cdb7f1194'
            '01e69d19a6176a6bf26ee703939c5bdea3f1245464ed5d3863dc5867a76b8b6a6fc7324912aee17458a0c6275ccdfa5abe63b88f7503c8d4dfd37d3f15f42700')

build() {
  cd "$pkgname-$pkgver"
  make PREFIX="/usr" PLATFORM_DEFINES="${CFLAGS}" CDEBUGFLAGS=""
}

package() {
  cd "$pkgname-$pkgver"
  make PREFIX="/usr" TARGET="$pkgdir" install

  install -Dm644 ../babeld.conf "$pkgdir"/etc/babeld.conf
  install -Dm644 ../babeld.service "$pkgdir"/usr/lib/systemd/system/babeld.service
  install -D -m644 LICENCE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
